package com.lefevre.cms.bean.message;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 订阅系统通知
 *
 * @author Lefevre
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("subscription_sys_notify")
@Entity
@Table(name = "subscription_sys_notify", indexes = {@Index(name = "subscription_sys_notify_1_idx", columnList = "systemNotifyId"), @Index(name = "subscriptionSystemNotify_2_idx", columnList = "userId,status,systemNotifyId")})
public class SubscriptionSystemNotify implements Serializable {
    private static final long serialVersionUID = -6898567200600595532L;

    /**
     * Id  由18位系统通知Id + 18位用户Id组成
     **/
    @Id
    @Column(length = 50)
    @TableId(type = IdType.INPUT)
    protected String id;

    /**
     * 系统通知Id
     **/
    @TableField("systemNotifyId")
    protected Long systemNotifyId;

    /**
     * 用户Id
     **/
    @TableField("userId")
    protected Long userId;

    /**
     * 通知内容
     **/
    @Transient
    @TableField(exist = false)
    protected String content;

    /**
     * 发送时间
     **/
    @Temporal(TemporalType.TIMESTAMP)
    @TableField("sendTime")
    protected Date sendTime;

    /**
     * 阅读时间
     **/
    @Temporal(TemporalType.TIMESTAMP)
    @TableField("readTime")
    protected Date readTime;

    /**
     * 消息状态 10:未读  20:已读  110:未读删除  120:已读删除
     **/
    @TableField("status")
    protected Integer status = 10;
}
